blob: a80d94650d3a6b724dc68aac18fd562ff38d2cf8 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-stripspace(1)
2=================
3
4NAME
5----
Junio C Hamano0df92712011-12-21 22:30:446git-stripspace - Remove unnecessary whitespace
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamano0df92712011-12-21 22:30:4412'git stripspace' [-s | --strip-comments] < input
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
Junio C Hamano0df92712011-12-21 22:30:4416
17Clean the input in the manner used by 'git' for text such as commit
18messages, notes, tags and branch descriptions.
19
20With no arguments, this will:
21
22- remove trailing whitespace from all lines
23- collapse multiple consecutive empty lines into one empty line
24- remove empty lines from the beginning and end of the input
25- add a missing '\n' to the last line if necessary.
26
27In the case where the input consists entirely of whitespace characters, no
28output will be produced.
29
30*NOTE*: This is intended for cleaning metadata, prefer the `--whitespace=fix`
31mode of linkgit:git-apply[1] for correcting whitespace of patches or files in
32the repository.
Junio C Hamano1a4e8412005-12-27 08:17:2333
34OPTIONS
35-------
Junio C Hamanoeb415992008-06-08 22:49:4736-s::
37--strip-comments::
Junio C Hamano0df92712011-12-21 22:30:4438Skip and remove all lines starting with '#'.
Junio C Hamanob1d6e882007-08-11 08:30:1639
Junio C Hamano0df92712011-12-21 22:30:4440EXAMPLES
41--------
42
43Given the following noisy input with '$' indicating the end of a line:
44
45--------
46|A brief introduction $
47| $
48|$
49|A new paragraph$
50|# with a commented-out line $
51|explaining lots of stuff.$
52|$
53|# An old paragraph, also commented-out. $
54| $
55|The end.$
56| $
57---------
58
59Use 'git stripspace' with no arguments to obtain:
60
61--------
62|A brief introduction$
63|$
64|A new paragraph$
65|# with a commented-out line$
66|explaining lots of stuff.$
67|$
68|# An old paragraph, also commented-out.$
69|$
70|The end.$
71---------
72
73Use 'git stripspace --strip-comments' to obtain:
74
75--------
76|A brief introduction$
77|$
78|A new paragraph$
79|explaining lots of stuff.$
80|$
81|The end.$
82---------
Junio C Hamano1a4e8412005-12-27 08:17:2383
Junio C Hamano1a4e8412005-12-27 08:17:2384GIT
85---
Junio C Hamanof7c042d2008-06-06 22:50:5386Part of the linkgit:git[1] suite